package com.xoa.controller.emergency;

import com.xoa.model.emergency.AssetGroup;
import com.xoa.service.emergency.AssetGroupService;
import com.xoa.util.common.wrapper.BaseWrapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("assetGroup")
public class AssetGroupController {

    @RequestMapping("index")
    public String index(){
        return "app/assetGroup/index";
    }

    @RequestMapping("selAsset")
    public String selAsset(){
        return "app/assetGroup/selAsset";
    }

    @Resource
    private AssetGroupService assetGroupService;


    // 添加
    @ResponseBody
    @RequestMapping("add")
    public BaseWrapper add(AssetGroup assetGroup){
        return assetGroupService.add(assetGroup);
    }

    // 更新
    @ResponseBody
    @RequestMapping("update")
    public BaseWrapper update(AssetGroup assetGroup){
        return assetGroupService.update(assetGroup);
    }

    // 删除
    @ResponseBody
    @RequestMapping("delete")
    public BaseWrapper delete(Integer groupId){
        return assetGroupService.delete(groupId);
    }

    // 根据id查询
    @ResponseBody
    @RequestMapping("selectById")
    public BaseWrapper selectById(Integer groupId,String type){
        return assetGroupService.selectById(groupId,type);
    }

    // 查询所有的基础信息 id和name
    @ResponseBody
    @RequestMapping("selectAllBaseInfo")
    public BaseWrapper selectAllBaseInfo(Integer page,Integer limit){
        return assetGroupService.selectAllBaseInfo(page, limit);
    }
}
